<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    ul{
      width: 200px;
      list-style: none;
    }
    li{
      height: 30px;
      line-height: 30px;
      padding-left: 20px;
      background-color: burlywood;
      margin-bottom: 10px;
    }
  </style>
</head>
<body>
  <ul id="ul">
    <li>1</li>
    <li>1</li>
    <li>1</li>
    <li>1</li>
    <li>1</li>
    <li>1</li>
    <li>1</li>
  </ul> 
</body>
<script>
  var ul = document.getElementById("ul");
  var liList = ul.children;
  ul.onclick = function(e){
    for(var i = 0; i < liList.length; i++){
      liList[i].style.backgroundColor = "";
    }
    e.target.style.backgroundColor = "pink"
  };
</script>
</html>